/**
 * 处理后的的扫码结果(对象)
 * @param {Object} Barcode	未处理前的扫码结果(字符串)
 */
function scanTransf(Barcode) {
	try {
		if (Barcode.indexOf('YG|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '员工',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('RJH|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '生产计划号',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('PMC|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '主计划号',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('KW|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '库位',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('FH|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '发货单',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('XSTH|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '退货单',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('XM|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '箱码',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('DH|') > -1 && Barcode.indexOf('DH|') == 0) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '到货单',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('GD|') > -1 && Barcode.indexOf('GD|') == 0) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '工单',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('CGTH|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '采购退货申请单',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('WXDD|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '外协订单',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('WXDH|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '外协到货',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('PDD|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '盘点单',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('PGD|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '派工单',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('SB|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '设备',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('EQ|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '设备',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('MJ|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '模具',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('MO|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '模具',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('GX|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '工序',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('CPPCM|') > -1 || Barcode.indexOf('CMMPC|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			// 标准批次条码解析 CPPCM|物料编码|批次
			if (Barcode.indexOf('CPPCM|') > -1) {
				if (BarcodeArray.length == 3) {
					return {
						type: '产品批次码',
						recode: recode,
						data: {
							tag: BarcodeArray[0],
							code: BarcodeArray[1],
							batch: BarcodeArray[2]
						}
					}
				} else if (BarcodeArray.length == 4) {
					return {
						type: '产品批次码',
						recode: recode,
						data: {
							tag: BarcodeArray[0],
							code: BarcodeArray[2],
							batch: BarcodeArray[3]
						}
					}
				}
			}
			// 广州奕华个性化解析 CMMPC|条码ID|物料编码|批次
			if (Barcode.indexOf('CMMPC|') > -1) {
				return {
					type: '产品批次码',
					recode: recode,
					data: {
						tag: BarcodeArray[0],
						code: BarcodeArray[2],
						batch: BarcodeArray[3]
					}
				}
			}
		} else if (Barcode.indexOf('CGDD|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '采购订单',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else if (Barcode.indexOf('SCLLSQ|') > -1) {
			var recode = Barcode;
			var BarcodeArray = recode.split('|');
			return {
				type: '领料申请单',
				recode: recode,
				data: {
					tag: BarcodeArray[0],
					code: BarcodeArray[1]
				}
			}
		} else {
			return '';
		}
	} catch (e) {
		return '';
	}
}
export default {
	scanTransf
}